extends ../common/layout
block content
  div(class='container')
    div(class='row-fluid show-grid')
      div(class='span12')
         h4 #{session.title} 
         hr 
         if(diaries.length)
           div(class='Diary-wrap')
             each item,i in diaries 
               div(class='Diary-row')
                 div(class='Diary-left')
                  a(href='/user/profile/#{item.pageurl}',title='#{item.created_user}')
                    img(src='#{item.avatarUrl}',alt='#{item.created_user}')
                 div(class='Diary-right')
                  h5 
                    a(href="/diary/#{item._id}") #{item.created_user}的日记
                    if(item.title)
                      a(href="/diary/#{item._id}") 
                        small [#{item.title}]
                      a(href="/user/#{item.pageurl}/notebook/#{item.notebook}") 
                        small [#{item.bookname}] 
                    else
                      a(href="/user/#{item.pageurl}/notebook/#{item.notebook}") 
                        small [#{item.bookname}] 
                    if(item.weather)
                      small [天气:#{item.weather}] 
                    if(item.mood)
                      small [心情:#{item.mood}] 
                    if(item.location)
                      small [地点:#{item.location}] 
                  div(class='Diary-content')
                     if(item.img)
                       img(src='#{item.img}')
                     p #{item.content}
                  div(class='bar') #{item.created_at} 
                    small #{item.commentcount}回复 
                    if(item.isSelf)
                      form(action='/diary/remove',method='post') 
                        input(type='hidden',value='#{item._id}',name='id')
                        div(class='btn-group')
                          a(class='btn btn-mini',href='/diary/edit/#{item._id}') Edit 
                          button(class='btn btn-mini btn-danger',type='submit') Del
            !{pag}
         else
           p There is nothing yet.
    include ../common/footer
